(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
gt(s(x), 0) → true
gt(0, y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0, 0, z) → true
div(0, s(x), z) → false
div(s(x), 0, s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0)))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
gt(s(x), s(y)) →+ gt(x, y)
gives rise to a decreasing loop by considering the right hand sides subterm at position [].
The pumping substitution is [x / s(x), y / s(y)].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
gt(s(x), 0') → true
gt(0', y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0', 0', z) → true
div(0', s(x), z) → false
div(s(x), 0', s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0')))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))
S is empty.
Rewrite Strategy: FULL
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
TRS:
Rules:
gt(s(x), 0') → true
gt(0', y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0', 0', z) → true
div(0', s(x), z) → false
div(s(x), 0', s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0')))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
gt,
div,
testThey will be analysed ascendingly in the following order:
gt < test
(8) Obligation:
TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
The following defined symbols remain to be analysed:
gt, div, test
They will be analysed ascendingly in the following order:
gt < test
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
gt(
gen_s:0'3_0(
+(
1,
n5_0)),
gen_s:0'3_0(
n5_0)) →
true, rt ∈ Ω(1 + n5
0)
Induction Base:
gt(gen_s:0'3_0(+(1, 0)), gen_s:0'3_0(0)) →RΩ(1)
true
Induction Step:
gt(gen_s:0'3_0(+(1, +(n5_0, 1))), gen_s:0'3_0(+(n5_0, 1))) →RΩ(1)
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
The following defined symbols remain to be analysed:
div, test
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
div(
gen_s:0'3_0(
n300_0),
gen_s:0'3_0(
n300_0),
gen_s:0'3_0(
c)) →
true, rt ∈ Ω(1 + n300
0)
Induction Base:
div(gen_s:0'3_0(0), gen_s:0'3_0(0), gen_s:0'3_0(c)) →RΩ(1)
true
Induction Step:
div(gen_s:0'3_0(+(n300_0, 1)), gen_s:0'3_0(+(n300_0, 1)), gen_s:0'3_0(c)) →RΩ(1)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) → true, rt ∈ Ω(1 + n3000)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
The following defined symbols remain to be analysed:
test
(15) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol test.
(16) Obligation:
TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) → true, rt ∈ Ω(1 + n3000)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
No more defined symbols left to analyse.
(17) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(18) BOUNDS(n^1, INF)
(19) Obligation:
TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) → true, rt ∈ Ω(1 + n3000)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
No more defined symbols left to analyse.
(20) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(21) BOUNDS(n^1, INF)
(22) Obligation:
TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
No more defined symbols left to analyse.
(23) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(24) BOUNDS(n^1, INF)